.\" -*- nroff -*-
.\" Copyright 2015      Los Alamos National Security, LLC. All rights reserved.
.\" Copyright 2010 Cisco Systems, Inc.  All rights reserved.
.\" Copyright 2007-2008 Sun Microsystems, Inc.
.\" Copyright (c) 1996 Thinking Machines Corporation
.\" $COPYRIGHT$
.TH MPI_Win_shared_query 3 "Jun 10, 2020" "4.0.4" "Open MPI"
.SH NAME
\fBMPI_Win_shared_query\fP \- Query a shared memory window

.SH SYNTAX
.ft R
.SH C Syntax
.nf
#include <mpi.h>
int MPI_Win_shared_query (MPI_Win \fIwin\fP, int \fIrank\fP, MPI_Aint *\fIsize\fP,
                          int *\fIdisp_unit\fP, void *\fIbaseptr\fP)

.fi
.SH INPUT PARAMETERS
.ft R
.TP 1i
win
Shared memory window object (handle).
.TP 1i
rank
Rank in the group of window \fIwin\fP (non-negative integer)
or MPI_PROC_NULL.

.SH OUTPUT PARAMETERS
.ft R
.TP 1i
size
Size of the window segment (non-negative integer).
.TP 1i
disp_unit
Local unit size for displacements, in bytes (positive integer).
.TP 1i
baseptr
Address for load/store access to window segment
(choice).
.TP 1i
IERROR
Fortran only: Error status (integer).

.SH DESCRIPTION
.ft R
\fBMPI_Win_shared_query\fP queries the process-local address for
remote memory segments created with MPI_Win_allocate_shared. This
function can return different process-local addresses for the same
physical memory on different processes. The returned memory can be
used for load/store accesses subject to the constraints defined in
MPI-3.1 \[char167] 11.7. This function can only be called with windows
of flavor MPI_WIN_FLAVOR_SHARED. If the passed window is not of flavor
MPI_WIN_FLAVOR_SHARED, the error MPI_ERR_RMA_FLAVOR is raised. When
rank is MPI_PROC_NULL, the \fIpointer\fP, \fIdisp_unit\fP, and
\fIsize\fP returned are the pointer, disp_unit, and size of the memory
segment belonging the lowest rank that specified \fIsize\fP > 0. If
all processes in the group attached to the window specified \fIsize\fP
= 0, then the call returns \fIsize\fP = 0 and a \fIbaseptr\fP as if
\fBMPI_Alloc_mem\fP was called with \fIsize\fP = 0.

.SH ERRORS
Almost all MPI routines return an error value; C routines as the value
of the function and Fortran routines in the last argument.
.sp
Before the error value is returned, the current MPI error handler is
called. By default, this error handler aborts the MPI job, except for
I/O function errors. The error handler may be changed with
MPI_Comm_set_errhandler; the predefined error handler
MPI_ERRORS_RETURN may be used to cause error values to be
returned. Note that MPI does not guarantee that an MPI program can
continue past an error.

.SH SEE ALSO
.ft R
.sp
MPI_Alloc_mem
MPI_Win_allocate_shared
